package com.dzl.movie;

import com.dzl.base.controller.BaseController;
import com.dzl.moive.pojo.WelfareMovieCity;
import com.dzl.moive.service.WelfareMovieCityService;
import com.dzl.util.EmptyUtils;
import com.dzl.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 电影城市(welfare_movie_city)表控制层
 * @author liuguanjun
 * @date 2021-11-02 11:50:29
 */
@RestController
@RequestMapping("/welfareMovieCity")
public class WelfareMovieCityController extends BaseController {

    @Autowired
    private WelfareMovieCityService service;

    /**
     * 获取城市列表
     * @author ChenLong
     * @date 2021-11-02 11:54:50
     **/
    @GetMapping(value = "getCityList")
    public JsonResult<List<WelfareMovieCity>> getCityList() {
        return JsonResult.success(service.getCityList("",null));
    }

    /**
     * 获取区县列表
     * @param citycode 城市编码
     * @author liuguanjun
     * @date 2021-11-03 14:48:50
     **/
    @GetMapping(value = "getCountyList")
    public JsonResult<List<WelfareMovieCity>> getCountyList(String citycode) {
        if(EmptyUtils.isEmpty(citycode)){
            return JsonResult.failWithMsg("缺少参数:城市编码[citycode]");
        }
        return JsonResult.success(service.getCountyList(citycode));
    }
}
